﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NeuralNetworks
{
    public static class IEnumerableExtensions
    {
        #region Extension Methods

        public static void For<T>(this IEnumerable<T> list, Action<T, int> action)
        {
            int i = 0;
            foreach (T item in list)
                action(item, i++);
        }

        public static void ForReversed<T>(this IEnumerable<T> list, Action<T, int> action)
        {
            int i = list.Count() - 1;
            foreach (T item in list.Reverse())
                action(item, i--);
        }

        #endregion
    }
}
